<?php
if ( IPB_THIS_SCRIPT != 'admin' )
{
	print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'init.php'.";
	exit();
}

class run_upgrade
{
	var $ipsclass;
	var $version_id;
	var $version_name;
	
	function auto_run()
	{
		$this->ipsclass->DB->load_cache_file(ROOT_PATH.'sources/market/install/'.$this->ipsclass->vars['sql_driver'].'_database_queries.php','sql_database_queries');
		
		$this->ipsclass->DB->build_query_from_cache('table_market_plugins',array(),'sql_database_queries');
		$this->ipsclass->DB->exec_query();
		$this->ipsclass->DB->build_query_from_cache('table_market_fee_logs',array(),'sql_database_queries');
		$this->ipsclass->DB->exec_query();
		$this->ipsclass->DB->build_query_from_cache('table_market_reward_logs',array(),'sql_database_queries');
		$this->ipsclass->DB->exec_query();
		
		$this->ipsclass->DB->sql_add_field("market_items", "allow_resell" ,"tinyint(1) NOT NULL" ,"'0'");
		
		$this->ipsclass->DB->do_update('components',array('com_url_title'=>$this->ipsclass->vars['market_name']),"com_section='market'");
		
		require_once( ROOT_PATH.'sources/action_admin/components.php' );
		$components           = new ad_components();
		$components->ipsclass =& $this->ipsclass;
		
		$components->components_rebuildcache();
	}
}
?>